package com.bckj.fastboot.auth.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.bckj.fastboot.upms.api.dto.UserAuthInfo;
import com.bckj.fastboot.upms.api.entity.SysUser;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * SysUserMapper
 *
 * @author wfc
 * @date 2025/10/16 11:52
 **/
@Mapper
public interface SysUserMapper extends BaseMapper<SysUser> {

    @Select("""
    select id,username,password,if(status=1,true,false) enabled,true accountNonExpired,true credentialsNonExpired,true accountNonLocked from sys_user where username=#{username} and delete_flag=0
    """)
    UserAuthInfo findByUsername(@Param("username") String username);
}
